package com.xiyou.weblog.admin.controller;

import com.xiyou.weblog.admin.model.vo.blogsettings.UpdateBlogSettingsReqVO;
import com.xiyou.weblog.admin.service.AdminBlogSettingsService;
import com.xiyou.weblog.common.aspect.ApiOperationLog;
import com.xiyou.weblog.common.utils.Response;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/blog/settings")
@Tag(name = "Admin 博客设置模块")
public class AdminBlogSettingsController {

    @Resource
    private AdminBlogSettingsService blogSettingsService;

    @PostMapping("/update")
    @ApiOperationLog(description = "修改博客基础信息")
    @Operation(summary = "修改博客基础信息")
    public Response updateBlogSettings(@RequestBody @Validated UpdateBlogSettingsReqVO updateBlogSettingsReqVO){
        return blogSettingsService.updateBlogSettings(updateBlogSettingsReqVO);
    }

    @PostMapping("/detail")
    @ApiOperationLog(description = "获取博客设置详情")
    @Operation(summary = "获取博客设置详情")
    public Response findDetail(){
        return blogSettingsService.findDetail();
    }
}
